{header}
<div class="card">
  <div class="card-header">
    操作
  </div>
  <div class="card-body">
    <a class="btn btn-primary" href="add_group" role="button">添加小组</a>
  </div>
</div>
<table class="table table-striped">
  <thead>
    <tr>
      <th scope="col">ID</th>
      <th scope="col">类型</th>
      <th scope="col">编号</th>
      <th scope="col" style="width: 200px;">操作</th>
    </tr>
  </thead>
  <tbody>
    {tr}
  </tbody>
</table>
<script type="text/javascript">
  function remove(id) {
    var _remove = $('#_remove');
    _remove.attr('disabled', true);
    $.ajax({
      url: '{base_url}library/remove_group',
      type: 'post',
      data: {
        id: id
      },
      success: function (data) {
        _remove.attr('disabled', false);
        var d = data.split(':');
        if (d.length !== 2) {
          console.error(data);
          layer.alert('服务器返回非法数据', {icon: 2});
          return;
        }
        if (d[0] === 'fail') {
          layer.alert('删除出错:' + d[1], {icon: 2});
          console.error('删除出错:' + d[1]);
        } else if (d[0] === 'success') {
          location.reload();
        } else {
          console.error(data);
          layer.alert('服务器返回多余数据', {icon: 2});
        }
      }
    });
  }
</script>
{nav}
{footer}

